﻿@model Inspinia_MVC5.Models.Borrow

@{
    ViewBag.Title = "办理借书";
}

<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-4">
        <h2>办理借书</h2>
        <ol class="breadcrumb">
            <li>
                @Html.ActionLink("列表", "Index")
            </li>
            <li class="active">
                <strong>创建借书单</strong>
            </li>
        </ol>
    </div>
    <div class="col-sm-8">
        <div class="title-action">
            @Html.ActionLink("重选图书", "Index", null, new { @class = "btn btn-primary" })
          
                <button class="btn btn-success btn-sm demo2"  style="visibility:hidden;" id="btnse">2</button>
                <button class="btn btn-success btn-sm demo3" style="visibility:hidden;" id="btnsi">1</button>

           


        </div>
    </div>
</div>
@*<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
    Launch demo modal
</button>*@
@*<button id="test"></button>*@

<div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <i class="fa fa-laptop modal-icon"></i>
                <h4 class="modal-title">选择借书用户</h4>
                <small class="font-bold">模糊查询用户姓名，以获取借书用户信息</small>
            </div>
            <div class="modal-body">
                <div class="ibox-content">
                    <div class="row">
                        @using (Ajax.BeginForm("GetUesr", new AjaxOptions
                        {
                            UpdateTargetId = "responese"
                        }))
                        {

                            <div class="col-sm-5 m-b-xs">
                                <select name="seaType" class="input-sm form-control input-s-sm inline">
                                    <option value="0">姓名</option>
                                    <option value="1">身份证号</option>
                                </select>
                            </div>
                            <div class="col-sm-4 m-b-xs">
                                <div data-toggle="buttons" class="btn-group">
                                    <label class="btn btn-sm btn-white"> <input type="radio" id="option1" value="0" name="role"> 教师 </label>
                                    <label class="btn btn-sm btn-white active"> <input type="radio" id="option2" value="1" name="role"> 学生 </label>
                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" placeholder="搜索" name="text" class="input-sm form-control"> <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> Go!</button>

                                        @*<button type="button" class="btn btn-sm btn-primary"> Go!</button>*@
                                    </span>
                                </div>
                            </div>
                        }


                    </div>
                    <div class="table-responsive" id="responese">

                    </div>

                </div>
                @*<p>
                    <strong>Lorem Ipsum is simply dummy</strong> text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown
                    printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,
                    remaining essentially unchanged.
                </p>
                <div class="form-group"><label>Sample Input</label> <input type="email" placeholder="Enter your email" class="form-control"></div>*@
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal">保存</button>
            </div>
        </div>
    </div>
</div>



<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>创建借书单</h5>
                </div>
                <div class="ibox-content">
                    <div class="wrapper wrapper-content animated fadeInRight">

                        <div class="row">
                            <div class="col-lg-12">

                                <div class="ibox product-detail">
                                    <div class="ibox-content">

                                        <div class="row">
                                            <div class="col-md-5">


                                                <div class="product-images">

                                                    <div>
                                                        <div class="image-imitation" style="padding-top: 0px;padding-bottom: 0px;background-color:white">
                                                            <img src="@ViewBag.Book.BookPic" style="width:100%;height:100%" alt=" 图书图片" />
                                                        </div>
                                                    </div>
                                                    @*<div>
                                            <div class="image-imitation">
                                                [IMAGE 2]
                                            </div>
                                        </div>
                                        <div>
                                            <div class="image-imitation">
                                                [IMAGE 3]
                                            </div>
                                        </div>*@


                                                </div>

                                            </div>
                                            <div class="col-md-7">

                                                <h2 class="font-bold m-b-xs">
                                                    @ViewBag.Book.BookName
                                                </h2>
                                                <small>@ViewBag.Book.BookType.TypeName</small>
                                                <div class="m-t-md">
                                                    <h2 class="product-main-price">
                                                        @string.Format("{0:C}", @ViewBag.Book.BookMoney)
                                                        <small class="text-muted">元</small>
                                                    </h2>
                                                </div>
                                                <hr>

                                                <h4>图书详情</h4>
                                                <div class="small text-muted">
                                                    @Html.Raw(ViewBag.Book.BookDesc)
                                                </div>
                                                @*<dl class="small m-t-md">
                                        <dt>Description lists</dt>
                                        <dd>A description list is perfect for defining terms.</dd>
                                        <dt>Euismod</dt>
                                        <dd>Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.</dd>
                                        <dd>Donec id elit non mi porta gravida at eget metus.</dd>
                                        <dt>Malesuada porta</dt>
                                        <dd>Etiam porta sem malesuada magna mollis euismod.</dd>
                                    </dl>*@
                                                <hr>

                                                <div>
                                                    @using (Html.BeginForm("Create", "Borrows"))
                                                    {
                                                        @Html.AntiForgeryToken()
                                                        <div class="btn-group">
                                                            <div id="result" class="alert alert-success">

                                                            </div>
                                                            <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal" onclick="return false"><i class="fa fa-cart-plus"></i> 选择借书用户</button>
                                                            <button id="cheshi" class="btn btn-white btn-sm" type="submit" onclick="return Check"><i class="fa fa-star"></i>办理借书 </button>
                                                            <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal1" onclick="return false"><i class="fa fa-cart-plus"></i> 人像验证</button>
                                                            @Html.ActionLink("返回", "Index", null, new { @class = "btn btn-white btn-sm" })
                                                            <input type="hidden" name="BookId" value="@ViewBag.Book.ID" />
                                                            <input type="hidden" id="role" name="Role" />
                                                            <input type="hidden" id="teacherid" name="TeacherId" />
                                                            <input type="hidden" id="studentid" name="StudentId" />
                                                            @*<button class="btn btn-white btn-sm"><i class="fa fa-envelope"></i> Contact with author </button>*@
                                                        </div>
                                                    }
                                                </div>



                                            </div>
                                        </div>

                                    </div>
                                    <div class="ibox-footer">
                                        <span class="pull-right">
                                            图书管理系统
                                        </span>
                                        请提示读者按期还书，请勿污损图书。
                                    </div>
                                </div>

                            </div>
                        </div>





                    </div>

                    @section Styles {
                        @Styles.Render("~/plugins/slickStyles")
                        @Styles.Render("~/plugins/slickThemeStyles")
                        @Styles.Render("~/plugins/sweetAlertStyles")


                    }
                    @section myscripts {
                        <script>
                            function RenLian() {

                                if ($("#result").text() == "请检查身份证号码") {
                                    $('#btnsi').click();

                                }
                                else if ($("#result").text() == "人相对比不予通过") {
                                    $('#btnsi').click();
                                }
                                else if ($("#result").text() == "请先输入身份证号码") {
                                    $('#btnsi').click();
                                }
                                else if ($("#result").text() == "没有找到用户图片") {
                                    $('#btnsi').click();
                                }
                                else {
                                    $('#btnse').click();

                                }
                            };
                        </script>

                    }

                    @section Scripts {
                        @Scripts.Render("~/plugins/slick")
                        @Scripts.Render("~/bundles/jqueryval")
                        @Scripts.Render("~/plugins/sweetAlert")

                        <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
                        <script>
                            $(function () {
                                //    $("#cheshi").click(function () {
                                //        var jiaoshi = $("input[name='jiaoshi']:checked").val();
                                //        var student = $("input[name='student']:checked").val();
                                //        if (jiaoshi == undefined && student == undefined) {
                                //            alert("清选择借书用户");
                                //            return false;

                                //        }
                                //        if (student != undefined) {
                                //            alert("学生" + student);

                                //        }
                                //        else {
                                //            alert("教师" + jiaoshi);

                                //        }
                                //    })
                                $("#cheshi").click(Check);
                                $('.demo2').click(function () {
                                    swal({
                                        title: "核验成功!",
                                        text: "可以办理借书业务!",
                                        type: "success"
                                    });
                                });
                                $('.demo3').click(function () {
                                    swal({
                                        title: "核验失败!",
                                        text: "请确认更多信息!",
                                    });
                                });
                            });
                            //function RenLian() {
                            //    return confirm();
                            //};
                            function Check() {
                                var jiaoshi = $("input[name='jiaoshi']:checked").val();
                                var student = $("input[name='student']:checked").val();
                                if (jiaoshi == undefined && student == undefined) {
                                    alert("清选择借书用户");
                                    return false;

                                }
                                if (student != undefined) {
                                    $("#role").val("0");
                                    $("#studentid").val(student);
                                    //alert($("#role").val() + $("#studentid").val());

                                    return true;

                                }
                                else {
                                    $("#role").val("1");
                                    $("#teacherid").val(jiaoshi);
                                    //alert($("#role").val() + $("#teacherid").val());
                                    return true;
                                }
                            }

                        </script>

                        <script type="text/javascript">
                            $(document).ready(function () {


                                $('.product-images').slick({
                                    dots: true
                                });

                            });
                        </script>
                        
                    }
                    @*@using (Html.BeginForm())
        {
            @Html.AntiForgeryToken()

            <div class="form-horizontal">
                @Html.ValidationSummary(true)*@

                    @*<div class="form-group">
            @Html.LabelFor(model => model.BookId, "BookId", new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("BookId", String.Empty)
                @Html.ValidationMessageFor(model => model.BookId)
            </div>
        </div>*@

                    @*<div class="form-group">
            @Html.LabelFor(model => model.Role, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Role)
                @Html.ValidationMessageFor(model => model.Role)
            </div>
        </div>*@

                    @*<div class="form-group">
            @Html.LabelFor(model => model.TeacherId, "TeacherId", new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("TeacherId", String.Empty)
                @Html.ValidationMessageFor(model => model.TeacherId)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.StudentId, "StudentId", new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("StudentId", String.Empty)
                @Html.ValidationMessageFor(model => model.StudentId)
            </div>
        </div>*@

                    @*<div class="form-group">
            @Html.LabelFor(model => model.Status, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Status)
                @Html.ValidationMessageFor(model => model.Status)
            </div>
        </div>*@

                    @*<div class="form-group">
            @Html.LabelFor(model => model.JieYueDate, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.JieYueDate)
                @Html.ValidationMessageFor(model => model.JieYueDate)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.YingHuanDate, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.YingHuanDate)
                @Html.ValidationMessageFor(model => model.YingHuanDate)
            </div>
        </div>*@

                    @*<div class="form-group">
            @Html.LabelFor(model => model.ReturnDate, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.ReturnDate)
                @Html.ValidationMessageFor(model => model.ReturnDate)
            </div>
        </div>*@

                    @*<div class="form-group">
            @Html.LabelFor(model => model.OverDue, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.OverDue)
                @Html.ValidationMessageFor(model => model.OverDue)
            </div>
        </div>*@

                    @*<div class="form-group">
            @Html.LabelFor(model => model.XuJieDate, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.XuJieDate)
                @Html.ValidationMessageFor(model => model.XuJieDate)
            </div>
        </div>*@

                    @*<div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Create" class="btn btn-primary" />
                </div>
            </div>
        </div>*@
                    @*}*@

                </div>
            </div>
        </div>
    </div>
</div>



